/*
 * 文件名称: ParamUtils.java Copyright 2011-2016 Ximalaya All right reserved.
 */
package top.zxybird.common.util;

/**
 * @author ted
 */
public class ParamUtils {

  public static Integer getInt(Object object) {
    if (object == null) {
      return null;
    }
    String str = String.valueOf(object);
    if (str.trim().isEmpty()) {
      return null;
    }
    return Integer.valueOf(str);
  }

  public static Long getLong(Object object) {
    if (object == null) {
      return null;
    }
    String str = String.valueOf(object);
    if (str.trim().isEmpty()) {
      return null;
    }
    return Long.valueOf(str);
  }

  public static Double getDouble(Object object) {
    if (object == null) {
      return null;
    }
    String str = String.valueOf(object);
    if (str.trim().isEmpty()) {
      return null;
    }
    return Double.valueOf(str);
  }

  public static Float getFloat(Object object) {
    if (object == null) {
      return null;
    }
    String str = String.valueOf(object);
    if (str.trim().isEmpty()) {
      return null;
    }
    return Float.valueOf(str);
  }

  public static Boolean getBoolean(Object object) {
    String str = String.valueOf(object);
    return Boolean.valueOf(str);
  }

  public static String getString(Object object) {
    if (object == null) {
      return null;
    }
    return String.valueOf(object);
  }
}
